/*****************************************************************************************************
*Header file for projects with block devices(MMC/SD/USB) as system disk
*Here we declear partition location and macros for disk drivers
*****************************************************************************************************/
#ifndef ___DISK_BLOCK
#define ___DISK_BLOCK

#define CONFIG_CMD_EXT2


#define BURN_STEP_LENGTH					0x1000
#define BLOCK_SIZE							512
#ifdef  CONFIG_ENV_IS_IN_SYS_DISK
#undef  CONFIG_ENV_OFFSET 
#define CONFIG_ENV_OFFSET					(SYS_DISK_START_ADDR_ENV) 
#define CONFIG_ENV_IS_IN_BLOCK
#undef  CONFIG_ANDROID_RECOVERY
#endif
 
#define CONFIG_SYS_LOCAL_PART_NUM			1
#define CONFIG_SYS_SYSTEM_PART_NUM			2
#define CONFIG_SYS_USERDATA_PART_NUM		3
#define CONFIG_SYS_EXTENTION_PART_NUM		4
#define CONFIG_SYS_CACHE_PART_NUM			5
#define CONFIG_SYS_MISC_PART_NUM			6                                                                        
#define CONFIG_SYS_RAMDISK_PART_NUM			7
#define CONFIG_SYS_KERNEL_PART_NUM			8

#define PARTITION_NUM                       8
#define CONFIG_UDATA_PART_LEN               512
/***********************From here we definite the start addr of each partition********************/
#define CONFIG_SYS_DISK_RD_OFFS             (oem_get_base(CONFIG_SYS_RAMDISK_PART_NUM))
#define CONFIG_SYS_DISK_KERNEL_OFFS         (oem_get_base(CONFIG_SYS_KERNEL_PART_NUM))
#define CONFIG_SYS_DISK_SYSTEM_OFFS         (oem_get_base(CONFIG_SYS_SYSTEM_PART_NUM))
#define CONFIG_SYS_DISK_MISC_OFFS           (oem_get_base(CONFIG_SYS_MISC_PART_NUM))
#define CONFIG_SYS_DISK_UDATA_OFFS          (oem_get_base(CONFIG_SYS_USERDATA_PART_NUM))

#define CONFIG_SYS_DISK_LK1_OFFS            (CONFIG_SYS_DISK_KERNEL_OFFS)
#define CONFIG_SYS_DISK_RE_OFFS             (CONFIG_SYS_DISK_LK1_OFFS+(8<<11))
#define CONFIG_SYS_DISK_LK2_OFFS            (CONFIG_SYS_DISK_KERNEL_OFFS+(24<<11))
#define CONFIG_SYS_DISK_BOOTLG_OFFS			(CONFIG_SYS_DISK_MISC_OFFS + (8 << 11))
#define CONFIG_SYS_DISK_KERNLG_OFFS			(CONFIG_SYS_DISK_MISC_OFFS + (12 << 11))
#define SYS_DISK_START_ADDR_ENV				(oem_get_base(CONFIG_SYS_LOCAL_PART_NUM)-0x40)

/*******************************end of astart address difinition*****************************/
/**************Here we fix the  max length a given image will ocuppy (unit MBytes)*****************/
#define CONFIG_SYS_LK_BURN_LEN              (8<<20)
#define CONFIG_SYS_RD_BURN_LEN				(2<<20)
#define CONFIG_SYS_RE_BURN_LEN              (16<<20)
#define CONFIG_SYS_BOOTLG_BURN_LEN			(4 << 20)
#define CONFIG_SYS_KERNLG_BURN_LEN			(4 << 20)
#define CONFIG_SYS_UDATA_BURN_LEN           (CONFIG_UDATA_PART_LEN<<20)
#define CONFIG_SYS_SYSTEM_BURN_LEN          (CONFIG_SYSTEM_PART_LEN<<20)

#define CONFIG_HIBERMARK_OFFSET				0x40
#define CONFIG_PART_STATE_BASE				0x48
#define CONFIG_SYSTEM_REAL_LEN				0x20
#define CONFIG_IMAGE_BASE_BUFFER			0x50
#endif
/*******************************************end of file****************************************************/
